Repository navigation
fix(libc): create noreplace streams exclusively - #5949
Conversation
|
I ran this PR's test on Linux. Setup: this PR's diff applied to main at 8cd937e (the PR's base is 421 commits behind it), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), clean environment.
So on Linux the new test catches the non-exclusive open, but not the Windows truncation case. I did not check Windows, macOS or a real GPU. AI-assisted: yes |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Tested on Linux (Arch), This PR breaks the existing test Line 113 of Cause: in Suggested fix: keep AI-assisted: yes |
|
@nicolasfalesy Thanks for the precise reproduction. I confirmed the read-only mode regression, kept AI-assisted: yes. — Codex |
|
Rechecked AI-assisted: yes |
|
Checked the |
|
Re-checked against current main (2fab88d): merges cleanly, |
What
C++
_Fiopenpreviously implementednoreplaceby probing the existing file for reading before opening it for writing. A Windows file shared for writing but not reading makes that probe fail, so the later open can truncate the file. The separate probe also lets concurrent creators both succeed.Keep
Noreplacein the mode key for writing modes and select the existing exclusivefopenmodes for its six valid combinations. Read-only modes continue to ignoreNoreplace, as the existingguest_fiopentest requires. The combinations follow Microsoft STL's_Fiopentable;fopenalready usesCREATE_NEWon Windows and exclusive host opening elsewhere. No separate existence probe remains.Tested
Original validation at PR head
d902afe2don maine34c47921: Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0, Release. The write-shared truncation regression failed on main and passed with the fix. The test covered all six exclusive mode combinations,ate,EEXISTfor an existing file, and twelve two-creator races with exactly one winner. The full default Windows build and four focused file tests passed.Follow-up at head
3f95553e8, merged with main5d9dcc42d:guest_fiopenruna70531c8+ new assertion)3f95553e8)BUILD_TESTING=ONbuild passed on the fixed source.ctest --test-dir build -R '^(guest_fiopen|file_streams|file_position|guest_posix_filesystem|guest_filesystem)$' --output-on-failure: 4/4 passed;guest_filesystemis not registered on Linux. Before the implementation fix,file_streamspassed andguest_fiopenfailed with the new assertion. Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox VM validation. Native/bare-metal Linux and native Linux GPU were not tested.ctest --test-dir build -R '^(guest_fiopen|file_streams|file_position|guest_filesystem|guest_posix_filesystem)$' --output-on-failure: 5/5 passed. The unmodified full build stops in a current-main AGC test because MinGW rejectsalignas(65536)(object-file maximum 8192). A temporary, uncommitted adjustment to that unrelated test allowed the remaining targets to build; it was removed before this commit. Full CTest with that adjustment: 1283 passed, 3 failed, 14 skipped.agc_driver_multisample_fill_host_onlypassed on serial retry;guest_pollandguest_kqueuerepeated their aborts. Their cause remains unverified.Checklist
main; no other open PR implements the same functionsFull platform runtime CI requires a write-access collaborator to dispatch it under repository policy.